package com.zyh.generic;

/**
 * @Author zyh
 * @Date 2024/7/31 9:52
 * @Description
 */

public class GenericDemo2 {
    public static void main(String[] args) {
        Coordinate<String> coo1 = new Coordinate<>("3.14","5.245");
        Coordinate<Double> coo2 = new Coordinate<>(3.145,3.14525);
        System.out.println(coo1);
        System.out.println(coo2);
    }
}
class Coordinate<T>{
    private T x;
    private T y;

    public Coordinate() {
    }

    public Coordinate(T x, T y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public String toString() {
        return "Coordinate{" +
                "x=" + x +
                ", y=" + y +
                '}';
    }
}
